package com.resource.provider.util;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by adminchen on 17/4/15.
 */
public class GetPackageMethodUtil {
    public static Map getTraceInfo() {

        StackTraceElement[] stacks = new Throwable().getStackTrace();
        int stacksLen = stacks.length;
        Map map = new HashMap<>();
        String packageName = stacks[2].getClassName();
        StringBuffer sb = new StringBuffer(packageName);
        sb.delete(sb.indexOf("provider"), sb.length());
        sb.append("interfaces.interfacex." + stacks[2].getFileName());
        sb.delete(sb.length() - 9, sb.length());
        String packageNames = sb.toString();
        map.put("packageName", packageNames);
        map.put("methodName", stacks[2].getMethodName());

        return map;
    }
}
